package com.axjy.text;

import com.axjy.mapper.MenuMapper;
import com.axjy.mapper.PermissionMapper;
import com.axjy.mapper.UserMapper;
import com.axjy.pojo.Menu;
import com.axjy.service.PermissionService;
import com.axjy.service.vo.Node;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by asus on 2018/2/27.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class Text {
    @Resource
    private PermissionMapper permissionMapper;

    @Resource
    private MenuMapper menuMapper;

    @Resource
    private PermissionService permissionService;

    @Resource
    private UserMapper userMapper;

    @Test
    public void textTree(){
         List<Integer> a=permissionMapper.searchMenuIds(1);
    }

    @Test
    public void textMenu(){
        List<Menu> list=menuMapper.searchLevel02(4);
        for(Menu m:list){
            System.out.println(m.getName());
        }
    }

    @Test
    public void textTree4(){
        List<Node> node=permissionService.search4Tree(4);
        for(Node n:node){
            System.out.println(n.getIcon());
        }
    }

    @Test
    public void textCreate(){
        Map<Menu,List<Menu>> map= permissionService.createMenus(3);
        for(Menu n:map.keySet()){
            System.out.println(n.getName());
        }
    }

    @Test
    public void textget(){
        userMapper.get(1);
    }
}
